<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:fo="http://www.w3.org/1999/XSL/Format">

	<xsl:key name="class-names" match="BugInstance"
		use="Class/@classname" />

	<xsl:template match="/BugCollection">
		<html>
			<head>
				<title>FindBugs Results</title>

				<style type="text/css">
					<xsl:text>
						body { font:normal 68% verdana,arial,helvetica;
						color:#000000; } table tr td, table tr th {
						font-size: 68%; } table.details tr th{
						font-weight: bold; text-align:left;
						background:#a6caf0; } table.details tr td{
						background:#eeeee0; }

						p { line-height:1.5em; margin-top:0.5em;
						margin-bottom:1.0em; } h1 { margin: 0px 0px 5px;
						font: 165% verdana,arial,helvetica } h2 {
						margin-top: 1em; margin-bottom: 0.5em; font:
						bold 125% verdana,arial,helvetica } h3 {
						margin-bottom: 0.5em; font: bold 115%
						verdana,arial,helvetica }
					</xsl:text>
				</style>

			</head>
			<body>
				<h1>&#160;&#160;&#160;FindBugs Results</h1>

				<xsl:for-each
					select="BugInstance[generate-id() = generate-id(key('class-names', Class/@classname)[1])]">

					<hr size="1">
						<h3>
							Class
							<xsl:value-of select="Class/@classname" />
						</h3>
					</hr>

					<table width="95%" cellspacing="2" cellpadding="5"
						border="0" class="details">
						<tr valign="top">
							<th width="80%">Bug Type</th>
							<th>Method</th>
							<th>Source Line</th>
						</tr>

						<xsl:for-each
							select="key('class-names', Class/@classname)">
							<xsl:variable name="type" select="./@type" />
							<tr valign="top" class="Pass">
								<td>
									<a
										href="http://findbugs.sourceforge.net/bugDescriptions.html#{$type}">
										<xsl:value-of select="$type" />
									</a>
								</td>
								<td>
									<xsl:value-of
										select="./Method/@name" />
								</td>
								<td>
									<xsl:value-of
										select="./Method/SourceLine/@start" />
								</td>
							</tr>
						</xsl:for-each>

					</table>

				</xsl:for-each>

			</body>
		</html>
	</xsl:template>

</xsl:stylesheet>